﻿// -------------------------------------------------------------------------
//    @FileName         :    NFCityMapGrid.h
//    @Author           :    Gao.Yi
//    @Date             :    2025-09-17
//    @Email			:    445267987@qq.com
//    @Module           :    NFCityMapGrid
//    @Desc             :
//
// -------------------------------------------------------------------------

#pragma once

#include "NFCityWorldObject.h"
#include "NFCityWorldObjectFunc.h"
#include "NFComm/NFObjCommon/NFNodeList.h"
#include "NFComm/NFObjCommon/NFObject.h"
#include "NFLogicCommon/NFLogicShmTypeDefines.h"

struct Proto_Vector3;

enum ECityWorldListType
{
    ECITYWLT_NPC = 1,
    ECITYWLT_PLAYER = 2,
    ECITYWLT_ALL = 4,
};

class NFCityMapGrid : public NF_OBJECT_TEMPLATE_MACRO(NFCityMapGrid, EOT_CITY_MAP_GRID_ID, NFObject)
public:
    NFCityMapGrid();
    ~NFCityMapGrid() override;
    int CreateInit();
    int ResumeInit();

public:
    int Init(int iGridIndexInMap);
    int Fin();

    int EnterGrid(NFCityWorldObject* pWorldObj, const Proto_Vector3& oPos, int iDirection);
    int LeaveGrid(NFCityWorldObject* pWorldObj);
    int IteratorWorldObject(NFICityWorldObjectFunc* pFunc, ECityWorldListType eListType);

private:
    uint16_t m_nGridIndexInMap;
    NFNodeObjList<NFCityWorldObject> m_oNpcList;
    NFNodeObjList<NFCityWorldObject> m_oPlayerList;
};
